<?php
if (!defined('BASEPATH'))
    exit('No direct script access allowed');
/**
 * CodeIgniter
 *
 * An open source application development framework for PHP 5.1.6 or newer
 *
 * @package		CodeIgniter
 * @author		ExpressionEngine Dev Team
 * @copyright	Copyright (c) 2008 - 2014, EllisLab, Inc.
 * @license		http://codeigniter.com/user_guide/license.html
 * @link		http://codeigniter.com
 * @since		Version 1.0
 * @filesource
 */
// ------------------------------------------------------------------------

/**
 * CodeIgniter Header Helpers
 *
 * @package		CodeIgniter
 * @subpackage	Helpers
 * @category	Helpers
 * @author		Ricardo Oliveira
 * @link		http://studioprogramar.com.br
 */
// ------------------------------------------------------------------------

/**
 * get_periodo
 *
 * Retorna o período atual do aluno.
 * recebe um array contendo os dados do requerimento e uma string contendo o codigo do usuario.
 *
 * @access	public
 * @param	array, string
 * @return	string
 */
if (!function_exists('get_periodo')) {

    function get_periodo($nuSMinicio) {
        $semInit = $nuSMinicio;
        if (!empty($semInit)) {
            $dataInit = explode("/", $semInit);
            $monthsLater = (date('Y') - $dataInit[0]) * 12;
            $monthsLater -= ($dataInit[1] === '1') ? 0 : 6;
            $monthsLater += ((int) date('m') < 6) ? 6 : 12;
            $semestre = $monthsLater / 6;
            return $semestre . '&ordm;';
        } else {
            return '--';
        }
    }

}

// ------------------------------------------------------------------------
/* End of file dasboard_helper.php */
/* Location: ./application/helpers/dasboard_helper.php */